  //计算天数差的函数，通用  
   function  DateDiff(startDate,  endDate){ 
	   var aDate, sDate1, oDate2, iDays ;
	   aDate = startDate.split('-');
	   oDate1 = new Date(aDate[1]+'-'+aDate[2]+'-'+aDate[0]) ;
	   aDate = endDate.split('-');
	   oDate2 = new Date(aDate[1]+'-'+ aDate[2] +'-'+aDate[0]);
	   iDays = parseInt((oDate2 -oDate1)/1000/60/60/24); //把相差的毫秒数转换为天数
	   return iDays ;
   }  
 
 //返回值如 '2015-03-19'  
 function  formatDate(date) {  
	    var y = date.getFullYear();  
	    var m = date.getMonth() + 1;  
	    m = m < 10 ? '0' + m : m;  
	    var d = date.getDate();  
	    d = d < 10 ? ('0' + d) : d;  
	    return y + '-' + m + '-' + d;  
 }
 //返回值如'2015-03-19 12:00：00''
  function  formatDateTime(date) {  
	    var y = date.getFullYear();  
	    var m = date.getMonth() + 1;  
	    m = m < 10 ? ('0' + m) : m;  
	    var d = date.getDate();  
	    d = d < 10 ? ('0' + d) : d;  
	    var h = date.getHours();  
	    var minute = date.getMinutes();  
	    var seconds = date.getSeconds();
	    minute = minute < 10 ? ('0' + minute) : minute;
	    seconds = seconds < 10 ? ('0' + seconds) : seconds;
	    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+seconds;
} 
 //将日期专程标准时间如 Thu Mar 19 2015 12:00:00 GMT+0800 (中国标准时间) 
 function parserDate(date) {  
	    var t = Date.parse(date);  
	    if (!isNaN(t)) {  
	        return new Date(Date.parse(date.replace(/-/g, "/")));  
	    } else {  
	        return new Date();  
	    }  
	} 